package com.xbongbong.saas.enums;

import com.xbongbong.pro.enums.permission.enums.ProPermissionAliasEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author: 汪腾伟
 * @date: 2020/8/12
 * @desrcption: 用于列表内容里面的按钮显示，初次建立目的回款计划列表里面有删除按钮
 * @version:1.0
 */
@Getter
public enum ListContentButtonEnum {

    /**
     * 回款计划删除
     */
    PAYMENT_TASK_DEL(XbbRefTypeEnum.PAYMENT_TASK.getCode(),SaasButtonEnum.DEL, ProPermissionAliasEnum.PAYMENT_TASK_DELETE.getAlias());

    private Integer businessType;
    private SaasButtonEnum anEnum;
    private String proPermissionAlias;

    ListContentButtonEnum(Integer businessType, SaasButtonEnum anEnum, String proPermissionAliasEnum) {
        this.businessType = businessType;
        this.anEnum = anEnum;
        this.proPermissionAlias = proPermissionAliasEnum;
    }

    public static List<ListContentButtonEnum> getByBusinessType(Integer businessType) {
        List<ListContentButtonEnum> list = new ArrayList<>();
        for (ListContentButtonEnum buttonEnum : ListContentButtonEnum.values()) {
            if (Objects.equals(businessType, buttonEnum.getBusinessType())) {
                list.add(buttonEnum);
            }
        }
        return list;
    }
}
